﻿using B.S.Sterilizationcenter.Domain.zyy;
using B.S.Sterilizationcenter.ErrorCode;
using B.S.Sterilizationcenter.Read.API.Appliaction.Commends.WJL;
using B.S.Sterilizationcenter.Read.API.Dto;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;

namespace B.S.Sterilizationcenter.Read.API.Controllers.WJL
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CreatsController : ControllerBase
    {
        private readonly IMediator mediator;

        public CreatsController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 移动端回收页面信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public async Task<ApiResult<List<ReturnApplicationDTO>>> GetReturnApplication([FromQuery]GetReturnApplicationCommands request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 移动端回收记录页面信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public async Task<ApiResult<List<ReturnApplicationDTO>>> GetReturnApplicationInfo([FromQuery]GetReturnApplicationInfoCommands request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 显示清洗记录
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public async Task<ApiResult<List<CleanwatchItemDto>>> Getcleanwatch([FromQuery]GetcleanwatchCommands request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 根据编号显示清洗记录
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public async Task<ApiResult<List<CleanwatchItemDto>>> GetCleanwatchId([FromQuery]GetCleanwatchIdCommands request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
